﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Huirui.Cavan.Domain.MainBoundedContext.ReportModule;
using Spring.Data.Generic;

namespace Huirui.Cavan.Infrastructure.Data.MainBoundedContext.StockModule
{
    public class StockBySalesOrderReportMapper : IRowMapper<StockBySalesOrderReport>
    {
        #region IRowMapper<StockBySalesOrderReport> 成员

        public StockBySalesOrderReport MapRow(System.Data.IDataReader reader, int rowNum)
        {
            StockBySalesOrderReport report = new StockBySalesOrderReport();
            report.Address = Convert.ToString(reader["Address"]);
            report.Code = Convert.ToString(reader["Code"]);
            report.CurrentStockOutNumber = 0;
            report.CurrentStockOutPrice = 0;
            report.DeliveryDate = Convert.ToDateTime(reader["DeliveryDate"]).ToShortDateString();
            report.Name = Convert.ToString(reader["Name"]);
            report.Number = Convert.ToDecimal(reader["Number"]);
            report.SalesOrderCode = Convert.ToString(reader["SalesOrderCode"]);
            report.CustomerName = Convert.ToString(reader["CustomerName"]);
            report.UnStockOutNumber = Convert.ToDecimal(reader["UnStockOutNumber"]);
            report.Specification = Convert.ToString(reader["Specification"]);
            report.TaxRate = Convert.ToDecimal(reader["TaxRate"]);
            report.CurrentStockOutPrice = Convert.ToDecimal(reader["StandardSalesPrice"]);
            report.DiscountRate = Convert.ToDecimal(reader["DiscountRate"]);
            report.UnitTransfer = Convert.ToString(reader["UnitTransfer"]);

            return report;
        }

        #endregion
    }
}
